/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import model.*;

/**
 *
 * @author Allan
 */
public class OrderStockList extends JPanel
{
    public OrderStockList(Stock stock)
    {
        setLayout(null);
        setBounds(0, 0, 279, 100);
        setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
        setBackground(Color.LIGHT_GRAY);
        
        JLabel lbl1 = new JLabel("Vare: ");
        JLabel lbl2 = new JLabel("Varegruppe: ");
        JLabel lbl3 = new JLabel("Antal: ");
        JLabel lbl4 = new JLabel("Stk. pris: ");
        JLabel lbl5 = new JLabel("Bestil: ");
        
        JLabel lblVare = new JLabel("" + stock.getProduct().getProductName());
        JLabel lblVaregruppe = new JLabel("" + stock.getProduct().getProductGroup().getGroupName());
        JLabel lblAntal = new JLabel("" + stock.getAmount());
        JLabel lblPris = new JLabel("" + stock.getProduct().getUnitPrice());
        
        final JTextField txtAmount = new JTextField();
        JButton btnOrder = new JButton("Tilføj til indkøbskurv");
        
        lbl1.setBounds(5, 5, 70, 14);
        lbl2.setBounds(5, 25, 70, 14);
        lbl3.setBounds(5, 45, 70, 14);
        lbl4.setBounds(140, 45, 50, 14);
        lbl5.setBounds(5, 70, 70, 14);
        
        lblVare.setBounds(75, 5, 180, 14);
        lblVaregruppe.setBounds(75, 25, 180, 14);
        lblAntal.setBounds(75, 45, 80, 14);
        lblPris.setBounds(195, 45, 80, 14);
        
        txtAmount.setBounds(75, 65, 50, 28);
        btnOrder.setBounds(130, 65, 140, 28);
        
        add(lbl1);
        add(lbl2);
        add(lbl3);
        add(lbl4);
        add(lbl5);
        add(lblVare);
        add(lblVaregruppe);
        add(lblAntal);
        add(lblPris);
        add(txtAmount);
        add(btnOrder);
        
        btnOrder.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                System.out.println("TESTER KNAPPEN " + txtAmount.getText());
                
                // Her skal være en reference til en metode til at lave ordrelinjer der skal have Ordre med som parameter
                
            }
        });
    }
}
